package com.zhanyf.heilan.cg.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhanyf.heilan.cg.dao.DevelopTypeMapper;
import com.zhanyf.heilan.cg.domain.DevelopProgress;
import com.zhanyf.heilan.cg.domain.DevelopType;
import com.zhanyf.heilan.cg.exception.DaoException;

@Service
public class DevelopTypeServiceImpl implements DevelopTypeService {

	@Autowired
	private DevelopTypeMapper developTypeMapper;

	@Override
	public List<DevelopType> listDevelopTypes() {
		return developTypeMapper.listDevelopTypes();
	}

	@Override
	public void addDevelopType(String typeName) throws DaoException {
		if (developTypeMapper.getDevelopTypeCountByTypeName(typeName) > 0)
			throw new DaoException("该开发类型已经存在");
		developTypeMapper.addDevelopType(typeName);
	}

	@Override
	public List<DevelopProgress> listDevelopProgressByDevelopType(int developTypeId) {
		return developTypeMapper.listDevelopProgressByDevelopType(developTypeId);
	}

	@Override
	public void addDevelopProgress(DevelopProgress developProgress) throws DaoException {
		throw new DaoException("未完成");
	}

}
